<?php $this->headTitle('Category');  ?>

<?php if(!empty($this->returnMessageSuccess)): ?>
<div class="success"><?php echo $this->escape($this->returnMessageSuccess[0]); ?></div>
<?php endif; ?>

<?php if(!empty($this->returnMessageWarning)): ?>
<div class="warning"><?php echo $this->escape($this->returnMessageWarning[0]); ?></div>
<?php endif; ?>

<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('images/category.png');">Category</h1>
    <div class="buttons">
        <a onclick="location = '<?php echo $this->url(array('do'=>'insert'),'catalogCategory',true); ?>'" class="button"><span>Insert</span></a>
        <a class="button" id="delete"><span>Delete</span></a>
    </div>
  </div>
  <div class="content">
      <form action="<?php echo $this->url(array('do'=>'delete'),'catalogCategory',true); ?>" method="post" enctype="multipart/form-data" id="form">
      <table class="list">
        <thead>
          <tr>
            <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
            <td class="left">Category Name</td>
            <td class="left">Category ID</td>
            <td class="right">Action</td>
          </tr>
        </thead>
        <tbody>
            <?php if($this->categories): ?>

                    <?php foreach($this->categories as $category): ?>
                      <tr>
                        <td style="text-align: center;"><input type="checkbox" name="selected[]" value="<?php echo $category['categoryId']; ?>" /></td>
                        <td class="left"><?php echo $this->escape($category['name']); ?></td>
                        <td class="left"><?php echo $category['categoryId']; ?></td>
                        <td class="right">[ <a href="<?php echo $this->url(array('do'=>'update','id'=>$category['categoryId']),'catalogCategory',true); ?>">View / Edit</a> ]</td>
                      </tr>
        <?php endforeach; ?>

	<?php else: ?>
          <tr>
            <td class="center" colspan="4">No results!</td>
          </tr>
       <?php endif; ?>
        </tbody>
      </table>
    </form>
  </div>
</div>